package com.example.event_resource_java.authority.controller;

import com.example.event_resource_java.authority.dao.JzChargeRegion;
import com.example.event_resource_java.authority.server.JzChargeRegionService;
import com.example.event_resource_java.commons.util.ApiResult;
import com.example.event_resource_java.commons.vo.ChargeRegionVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.List;

@Api("负责区域管理")
@RestController
@RequestMapping("/charge")
public class ChargeRegionController {

    @Autowired
    private JzChargeRegionService jzChargeRegionService;

    @GetMapping("/list")
    public ApiResult list() {
        List<ChargeRegionVO> chargeRegionVOS = jzChargeRegionService.queryList();
        return ApiResult.success(chargeRegionVOS);
    }

    @GetMapping("/search")
    public ApiResult search(String question) {
        HashSet<ChargeRegionVO> search = jzChargeRegionService.search(question);
        return ApiResult.success(search);
    }
}
